<?php

/**
 * Echantillon filter form base class.
 *
 * @package    appcemhti
 * @subpackage filter
 * @author     Steve Cancès
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseEchantillonFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_etat_echantillon' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EtatEchantillon'), 'add_empty' => true)),
      'id_lot'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lot'), 'add_empty' => true)),
      'id_type_forme'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TypeForme'), 'add_empty' => true)),
      'id_lieu'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lieu'), 'add_empty' => true)),
      'id_user'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'nom'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_creation'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'epaisseur'           => new sfWidgetFormFilterInput(),
      'diametre'            => new sfWidgetFormFilterInput(),
      'longueur'            => new sfWidgetFormFilterInput(),
      'largeur'             => new sfWidgetFormFilterInput(),
      'rectangle'           => new sfWidgetFormFilterInput(),
      'a'                   => new sfWidgetFormFilterInput(),
      'b'                   => new sfWidgetFormFilterInput(),
      'c'                   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'id_etat_echantillon' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('EtatEchantillon'), 'column' => 'id_etat_echantillon')),
      'id_lot'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lot'), 'column' => 'id_lot')),
      'id_type_forme'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TypeForme'), 'column' => 'id_type_forme')),
      'id_lieu'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lieu'), 'column' => 'id_lieu')),
      'id_user'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id_user')),
      'nom'                 => new sfValidatorPass(array('required' => false)),
      'created_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'date_creation'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'epaisseur'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'diametre'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'longueur'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'largeur'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'rectangle'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'a'                   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'b'                   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'c'                   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('echantillon_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Echantillon';
  }

  public function getFields()
  {
    return array(
      'id_echantillon'      => 'Number',
      'id_etat_echantillon' => 'ForeignKey',
      'id_lot'              => 'ForeignKey',
      'id_type_forme'       => 'ForeignKey',
      'id_lieu'             => 'ForeignKey',
      'id_user'             => 'ForeignKey',
      'nom'                 => 'Text',
      'created_at'          => 'Date',
      'updated_at'          => 'Date',
      'date_creation'       => 'Date',
      'epaisseur'           => 'Number',
      'diametre'            => 'Number',
      'longueur'            => 'Number',
      'largeur'             => 'Number',
      'rectangle'           => 'Number',
      'a'                   => 'Number',
      'b'                   => 'Number',
      'c'                   => 'Number',
    );
  }
}
